<template>
  <div class="mine">
    <el-carousel :autoplay="false" arrow="always" height="94vh" id="form" v-if="!isLogined"> 
      <el-carousel-item>
        <login @changeIsLogined="change"></login>
      </el-carousel-item>
      <el-carousel-item>
        <register></register>
      </el-carousel-item>
    </el-carousel>
    <mine-main @changeIsLogined="change" v-else></mine-main>
  </div>
</template>

<script>
import login from '@/components/visit/login'
import register from '@/components/visit/register'
import mineMain from '@/components/visit/mineMain'

import cookie from '@/tools/cookie'



export default {
  name: "Mine",
  data() {
    return {
      myInfo:[],
      isLogined: localStorage.getItem('pta_username') ? true : false
      // test_token:
    }
  },
  components: {
    login,
    register,
    'mine-main': mineMain
  },
  methods: {
    change () {
      // console.log('父收到')
      this.isLogined = !this.isLogined
    }
  },
  mounted() {
    //获取用户信息
    // this.$axios.get('/yb/user/me?access_token=11b332feb6d564def2c4879a7bb2e24faf14cbd0',{
    //   // params:{
    //   //   'access_token':'27e626ac2d1f977c4d4c2393fda1ace249ca50ee'
    //   // }
    // }).then((res) => {
    //   if(res.data.status == 'success')
    //     this.myInfo.push(res.data.info)
    //   else
    //     console.warn(res.data)
    // }).catch((err) => {
    //   console.warn('获取用户信息失败，错误为',err)
    // })
    
    // cookie.getAllCookies()
    // cookie.deleteCookie('test')
    // if (cookie.allCookies['pta_username']) {
    //   console.log('有的')
    //   this.isLogined = true
    // } 
  }
}
</script>

<style scoped>
  /* .mine{
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    position: fixed;
    width: 100%;
    height: 100vh;
    background-size: 100% 100%;
    
  }

  .my-info{
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .user-pic{
    height: 10rem;
    width: 10rem;
    border: 2px solid #fff;
    border-radius: 16rem;
    text-align: center;
    overflow: hidden;

  }
  .info-list{
    width: 80%;
    background-color: rgba(135,135,135,0.4);
    border-radius: 15px;
    backdrop-filter: blur(5px);
  }
  .one-info{
    text-align: left;
    list-style: none;
  }
  li.one-info>div{
    padding: 1rem;
  }
  .one-info>div img {
    height: 1rem;
  }
  .user-pic img{
    height: 100%;
  } */
  .mine {
    margin: 0 auto;
    width: 100vw;
    height: 100vh;
  }
  #form {
    width: 100%;
    /* height: 100%; */
    /* margin: 1vh auto; */
    background: #ddd3;
    /* border: 1px solid #eee; */
    /* border-radius: 5vw; */

  }
  
  .el-carousel__item h3 {
    color: #475669;
    font-size: 18px;
    opacity: 0.75;
    /* line-height: ; */
    margin: 0;
    height: 100%;
  }
  
  .el-carousel__item:nth-child(2n) {
    /* background-color: #99a9bf; */
    background: linear-gradient(30deg,#4ac8f3,#9370db);
  }
  
  .el-carousel__item:nth-child(2n+1) {
    background: linear-gradient(-45deg,#eaa985,#8d58ea);
  }
</style>